<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <title>后台管理系统</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!--图标-->
    <link rel="stylesheet" type="text/css" href="../assets/css/font-awesome.min.css">

    <!--布局框架-->
    <link rel="stylesheet" type="text/css" href="../assets/css/util.css">

    <!--主要样式-->
    <link rel="stylesheet" type="text/css" href="../assets/css/main.css">
</head>

<body>

    <div class="login">
        <div class="container-login100">
            <div class="wrap-login100">
                <div class="login100-pic js-tilt" data-tilt>
                    <img src="../assets/img/img-01.png" alt="IMG">
                </div>

                <form class="login100-form validate-form"  id="login_form" onsubmit="return false">
                    <span class="login100-form-title">
                        管理员登录
                    </span>

                    <div class="wrap-input100 validate-input">
                        <input class="input100" type="text" name="admin_name" placeholder="管理员账号">
                        <span class="focus-input100"></span>
                        <span class="symbol-input100">
                            <i class="fa fa-user" aria-hidden="true"></i>
                        </span>
                    </div>

                    <div class="wrap-input100 validate-input">
                        <input class="input100" type="password" name="admin_pwd" placeholder="密码">
                        <span class="focus-input100"></span>
                        <span class="symbol-input100">
                            <i class="fa fa-lock" aria-hidden="true"></i>
                        </span>
                    </div>

                    <div class="container-login100-form-btn">
                        <button class="login100-form-btn" id="login">
                            登陆
                        </button>
                    </div>

                    <div class="text-center p-t-12">
                        <a class="txt2" href="javascript:">
                            忘记密码？
                        </a>
                    </div>

                    <div class="text-center p-t-136">
                        
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="../assets/layui/layui.js"></script>
    <script>
        layui.use(['jquery','layer'], function() {
            var $ = layui.jquery;
            var layer = layui.layer;
            $('#login').click(function() {
                var form_data = $("#login_form").serialize();
                $.ajax({
                    type: "POST",
                    url: "controller.php",
                    dataType: "json",
                    data:form_data,
                    success: function(data) {
                        if (data.code == 200) {
                            layer.msg(data.msg);
                            setTimeout(function(){ window.location.href="./index.php";},900);
                        } else {
                            layer.msg(data.msg);
                        }
                    },
                    error: function(jqXHR) {
                        console.log("Error: " + jqXHR.status);
                    }
                });
            }
            );
            
        });
    </script>
</body>

</html>